package cn.yes.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class Appjdbcupdate {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        String usl="jdbc:mysql://localhost:43306/test";
        String username="root";
        String password="root";
        String sql="UPDATE `user` SET username='lili' WHERE id=4";
        Connection connection = DriverManager.getConnection(usl, username, password);
        Statement statement = connection.createStatement();
        int i = statement.executeUpdate(sql);
        if(i!=0){
            System.out.println("数据更新成功");
        }
    }
}
